<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<c:if test="${userID==null}">
  <c:redirect url="index-msa.jsp" />
</c:if>


<html>
  <head>
    <title>welcome</title>
  </head>

  <body link="#000000" vlink="#000000" alink="#000000">
    <sql:query var="users" dataSource="${dataSource}">
    select c_uid,c_pwd,c_accesses,c_first,c_last,c_bad,c_posted,c_type from t_users where c_uid = ? 
    <sql:param value="${userID}" />
    </sql:query>

    <c:forEach var="row" items="${users.rows}">
      <table border="0" style="border-collapse: collapse"
      bordercolor="#111111" cellpadding="0" cellspacing="0">
        <tbody>
          <tr>
            <td bgcolor="#0000FF" colspan="2">
              <b>
                <font color="#FFFFFF">Welcome 
                <c:out value="${userID}" />
                </font>
              </b>

              <font color="#FFFFFF">&#160;</font>
            </td>
          </tr>

          <tr>
            <td bgcolor="#FFFF66"><b>Login ID</b></td>

            <td bgcolor="#FFFF66">
              <c:out value="${row.c_uid}" />
            </td>
          </tr>

          <tr>
            <td bgcolor="#FFFFFF"><b>Times on</b></td>

            <td>
              <c:out value="${row.c_accesses}" />
            </td>
          </tr>

          <tr>
            <td bgcolor="#FFFF66"><b>First Login</b></td>

            <td bgcolor="#FFFF66">
              <fmt:formatDate value="${row.c_first}" />
            </td>
          </tr>

          <tr>
            <td bgcolor="#FFFFFF"><b>Last Login</b></td>

            <td>
              <fmt:formatDate value="${row.c_last}" />
            </td>
          </tr>

          <tr>
            <td bgcolor="#FFFF66"><b>Failed Logins</b></td>

            <td bgcolor="#FFFF66">
              <c:out value="${row.c_bad}" />
            </td>
          </tr>

          <tr>
            <td><b>Messages Posted&nbsp;&nbsp;</b></td>

            <td>
              <c:out value="${row.c_posted}" />
            </td>
          </tr>

          <tr>
            <td bordercolor="#000000" bgcolor="#FFFF66"><b>User
            Type</b></td>

            <td bgcolor="#FFFF66">
              <c:out value="${row.c_type}" />
            </td>
          </tr>
        </tbody>
      </table>
    </c:forEach>


    <sql:update var="result" dataSource="${dataSource}">update
    t_users set c_accesses = c_accesses + 1, c_bad = 0, c_last =
    now() where c_uid = ? 
    <sql:param value="${userID}" />
    </sql:update>


    <br />

    <a href="main.jsp">[Continue]</a>
  </body>
</html>